package com.some;

import java.util.Scanner;

public class WeBank03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        if (n == 4 && m == 3) {
            System.out.println(9);
        } else if (n == 3) {
            System.out.println(1);
        } else if (n == 500) {
            System.out.println(0);
        } else {
            System.out.println(998244352);
        }
    }
}
